home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 011-020 / amok11 / trackdisksupport / trackdisksupport.def < prev    next >
Text File  |  1993-11-04  |  9KB  |  207 lines

  1. (*---------------------------------------------------------------------------
  2.     :Program.    TrackDiskSupport
  3.     :Author.     Fridtjof Siebert
  4.     :Address.    Nobileweg 67, D-7-Stgt-40
  5.     :Phone.      (0)711/822509
  6.     :Shortcut.   [fbs]
  7.     :Version.    .9
  8.     :Date.       05-Dez-88
  9.     :Copyright.  PD, no commercial use !!!
  10.     :Language.   Modula-II
  11.     :Translator. M2Amiga
  12.     :Contents.   Procedures to simplify usage of the trackdisc.device
  13.     :Remark.     You are NOT allowed to use this to write a Virus !!!
  14. ---------------------------------------------------------------------------*)
  15.  
  16. DEFINITION MODULE TrackDiskSupport;
  17.  
  18. FROM SYSTEM      IMPORT ADDRESS;
  19.  
  20. FROM Exec        IMPORT Byte;
  21.  
  22. (*------  Open TrackDisk:  ------*)
  23.  
  24. PROCEDURE OpenTrackDisk(device: INTEGER; AllowNon35: BOOLEAN): Byte;
  25.  
  26. (* :Input.    device: Drive Number (0..3)                                  *)
  27. (* :Input.    AllowNon35: Allow non 3.5" drives (usually 5.25" drives)     *)
  28. (* :Result.   Error number or 0 if successfully                            *)
  29. (* :Semantic. Opens the Trackdisk.device for drive # device. It can be     *)
  30. (* :Semantic. several times with different drive numbers.                  *)
  31. (* :Note.     Don't forget CloseTrackDisk()!                               *)
  32.  
  33. (*------  Close TrackDisk:  ------*)
  34.  
  35. PROCEDURE CloseTrackDisk(device: INTEGER);
  36.  
  37. (* :Input.    device: Drive Number (0..3)                                  *)
  38. (* :Semantic. Closes the TrackDisk.device open via OpenTrackDisk()         *)
  39.  
  40. (*------  Get Disk Change Value:  ------*)
  41.  
  42. PROCEDURE GetDiskChange(device: INTEGER): LONGCARD;
  43.  
  44. (* :Input.    device: Drive Number (0..3)                                  *)
  45. (* :Result.   Disk Change number (necessary to detect disk changes)        *)
  46.  
  47. (*------  Is there a disk inserted?  ------*)
  48.  
  49. PROCEDURE ChangeState(device: INTEGER): BOOLEAN;
  50.  
  51. (* :Input.    device: Drive Number (0..3)                                  *)
  52. (* :Result.   TRUE if disk inserted, else FALSE                            *)
  53.  
  54.  
  55.  
  56. (*------  Test Write-Protection:  ------*)
  57.  
  58. PROCEDURE ProtStatus(device: INTEGER): BOOLEAN;
  59.  
  60. (* :Input.    device: Drive Number (0..3)                                  *)
  61. (* :Result.   TRUE if write enabled                                        *)
  62.  
  63. (*------  Motor Control:  ------*)
  64.  
  65. PROCEDURE Motor(device: INTEGER; On: BOOLEAN): BOOLEAN;
  66.  
  67. (* :Input.    device: Drive Number (0..3)                                  *)
  68. (* :Input.    On: turm Motor on (TRUE) or off (FALSE)                      *)
  69. (* :Result.   old motor state: TRUE = on, FALSE = off                      *)
  70. (* :Semantic. Turns motor on or off according to On.                       *)
  71.  
  72. (*------  Seek:  ------*)
  73.  
  74. PROCEDURE Seek(device: INTEGER; Offset: LONGCARD): Byte;
  75.  
  76. (* :Input.    device: Drive Number (0..3)                                  *)
  77. (* :Input.    Offset: where to seek to. Must be a multiple of              *)
  78. (* :Input.            numHeads * numSecs * sectors (2*11*512)              *)
  79. (* :Semantic. Moves head to specified track                                *)
  80.  
  81. (*------  Read Block:  ------*)
  82.  
  83. PROCEDURE ReadBlock(device: INTEGER;
  84.                     Block: INTEGER;
  85.                     Buffer: ADDRESS;
  86.                     BlockCnt: CARDINAL;
  87.                     ChangeCnt: LONGCARD): Byte;
  88.  
  89. (* :Input.    device:   Drive Number (0..3)                                *)
  90. (* :Input.    Block:    the disk's block # to be read                      *)
  91. (* :Input.    Buffer:   at least 512 Bytes of Chip memory to store data    *)
  92. (* :Input.    BlockCnt: Number of Blocks to be read                        *)
  93. (* :Input.    ChangeCnt:last changenumber to check diskchanges             *)
  94. (* :Result.   error number or 0 if none                                    *)
  95. (* :Semantic. Reads BlockCnt Blocks from Disk                              *)
  96.  
  97. (*------  Read Sector:  ------*)
  98.  
  99. PROCEDURE ReadCycSec(device: INTEGER;
  100.                      cyl,sec,head: INTEGER;
  101.                      Buffer: ADDRESS;
  102.                      BlockCnt: CARDINAL;
  103.                      ChangeCnt: LONGCARD): Byte;
  104.  
  105. (* :Input.    device: Drive Number (0..3)                                  *)
  106. (* :Input.    cyl,sec,head: specify the block to be read                   *)
  107. (* :Input.    Buffer:       512 Bytes of Chip memory to store data         *)
  108. (* :Input.    BlockCnt:     Number of Blocks to be read                    *)
  109. (* :Input.    ChangeCnt:    last changenumber to check diskchanges         *)
  110. (* :Result.   error number                                                 *)
  111. (* :Semantic. Reads BlockCnt blocks                                        *)
  112.  
  113. (*------  Write Block:  ------*)
  114.  
  115. PROCEDURE WriteBlock(device: INTEGER;
  116.                      block: INTEGER;
  117.                      Buffer: ADDRESS;
  118.                      BlockCnt: CARDINAL;
  119.                      ChangeCnt: LONGCARD): Byte;
  120.  
  121. (* :Input.    device:    Drive Number (0..3)                               *)
  122. (* :Input.    block:     the block # to be written                         *)
  123. (* :Input.    Buffer:    512 Bytes of Chip memory storing the data         *)
  124. (* :Input.    BlockCnt:  # of blocks to be written                         *)
  125. (* :Input.    ChangeCnt: last changenumber to check diskchanges            *)
  126. (* :Result.   error number                                                 *)
  127. (* :Semantic. Writes BlockCnt blocks                                       *)
  128.  
  129. (*------  Write Sector:  ------*)
  130.  
  131. PROCEDURE WriteCycSec(device: INTEGER;
  132.                       cyl,sec,head: INTEGER;
  133.                       Buffer: ADDRESS;
  134.                       BlockCnt: CARDINAL;
  135.                       ChangeCnt: LONGCARD): Byte;
  136.  
  137. (* :Input.    device: Drive Number (0..3)                                  *)
  138. (* :Input.    cyl,sec,head: specify the block to be written                *)
  139. (* :Input.    Buffer:       512 Bytes of Chip memory storing the data      *)
  140. (* :Input.    BlockCnt:     # of blocks to be written                      *)
  141. (* :Input.    ChangeCnt:    last changenumber to check diskchanges         *)
  142. (* :Result.   error number                                                 *)
  143. (* :Semantic. Writes BlockCnt blocks                                       *)
  144.  
  145. (*------  Update:  ------*)
  146.  
  147. PROCEDURE Update(device: INTEGER;
  148.                  ChangeCnt: LONGCARD): Byte;
  149.  
  150. (* :Input.    device: Drive Number (0..3)                                  *)
  151. (* :Input.    ChangeCnt: last changenumber to check diskchanges            *)
  152. (* :Result.   error                                                        *)
  153. (* :Semantic. Forces to write buffer to disk                               *)
  154.  
  155. (*------  Format:  ------*)
  156.  
  157. PROCEDURE FormatTrack(device: INTEGER;
  158.                       cyl: INTEGER;
  159.                       Buffer: ADDRESS;
  160.                       CycCnt: CARDINAL;
  161.                       ChangeCnt: LONGCARD): Byte;
  162.  
  163. (* :Input.    device: Drive Number (0..3)                                  *)
  164. (* :Input.    cyl:       First Cyclinder to be formatted                   *)
  165. (* :Input.    Buffer:    Buffer containing cyclinder data (>= 22*512 Bytes)*)
  166. (* :Input.    CycCnt:    Number of Tracks to be formatted                  *)
  167. (* :Input.    ChangeCnt: last changenumber to check diskchanges            *)
  168. (* :Result.   error number                                                 *)
  169. (* :Semantic. Writes track to unformatted disk                             *)
  170.  
  171. (*------  Create Diskremove-Interrupt:  ------*)
  172.  
  173. PROCEDURE Remove(device: INTEGER;
  174.                  IntProc: ADDRESS): Byte;
  175.  
  176. (* :Input.   device: Drive Number (0..3)                                   *)
  177. (* :Input.   IntProc: The Interrupt Procedure's address or NIL to remove it*)
  178. (* :Result.  error #                                                       *)
  179. (* :Semantic.Adds / Removes interrupt to handle diskchanges                *)
  180. (* :Note.    I was too lazy to test this ;-)                               *)
  181.  
  182. (*------  Mark Track as invalid:  ------*)
  183.  
  184. PROCEDURE Clear(device: INTEGER): Byte;
  185.  
  186. (* :Input.    device: Drive Number (0..3)                                  *)
  187. (* :Result.   error or 0                                                   *)
  188. (* :Semantic. Marks trackbuffer as invalid --> avoids rewriting it         *)
  189.  
  190. (*------  3.5 or 5.25 Drive:  ------*)
  191.  
  192. PROCEDURE GetDriveType(device: INTEGER): LONGCARD;
  193.  
  194. (* :Input.    device: Drive Number (0..3)                                  *)
  195. (* :Result.   1 if 3.5 inch drive connected, else ??? (5.25")              *)
  196. (* :Note.     I Couldn't test this (I don't have a 5.25" Drive)            *)
  197.  
  198. (*------  How many Trax:  ------*)
  199.  
  200. PROCEDURE GetNumTracks(device: INTEGER): LONGCARD;
  201.  
  202. (* :Input.    device: Drive Number (0..3)                                  *)
  203. (* :Result.   number of tracks the drive has                               *)
  204.  
  205.  
  206. END TrackDiskSupport.
  207.